<?php

namespace app\crm\model;

use app\crm\model\ShopPerson;
use app\admin\model\Common;
use app\crm\model\ShopPersonAchievementModel;
use think\facade\Db;

/**
 * 订单商品模型
 * @package app\shop\model
 * @author LIU
 * @create 2021-10-01
 */
class ShopGoods extends Common{
    /**
     * 表名
     * @var string
     */
    protected $name = 'shop_goods';
    protected $defaultSoftDelete = 0;

    public function getGoodsList(){

        $where = [
            ['status','=',1],
            ['is_project','in',[1,4]],
        ];
        $goods = $this->where($where)->select()->toArray();
        if(!empty($goods)){
            foreach ($goods as $k=>&$v){
                $data = [];
                $data['id'] = $v['id'];
                $data['spec_name'] = $v['spec_name'];
                $str = !empty($v['spec_name'])?"-".$v['spec_name']:'';
                $data['name'] =$v['name'].$str;
                $data['goods_price'] =$v['goods_price'];
                $data['kingdee_code'] = $v['kingdee_code'];
                $data['children'] = [];
                $return[]= $data;
            }
        }
        return  $return;

    }



}
